package com.edu.demo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.annotation.TableName;
import com.edu.demo.utils.FileUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.apache.logging.log4j.util.Strings;

/**
 * <p>
 *
 * </p>
 *
 * @author jixuewei
 * @since 2023-01-12
 */
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "Project对象", description = "")
public class Project implements Serializable ,Comparable<Project>{

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("项目名称")
    private String title;

    @ApiModelProperty("项目描述")
    private String description;

    @ApiModelProperty("项目招聘要求")
    private String requirement;

    @ApiModelProperty("面向专业")
    private String major;

    @ApiModelProperty("发布老师id")
    private Integer tId;

    @ApiModelProperty("发布老师名字")
    private String tName;

    @ApiModelProperty("项目图片")
    private String photo;

    @ApiModelProperty("难度等级")
    private String difficulty;

    @ApiModelProperty("拟招人数")
    private Integer numberOfPeople;

    @ApiModelProperty("酬劳范围")
    private String remuneration;

    @ApiModelProperty("实验室")
    private String laboratory;

    @ApiModelProperty("访问次数")
    private Integer visits;

    @ApiModelProperty("发布时间")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date releaseTime;

    @ApiModelProperty("项目估计完成截止时间")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date deadline;

    @ApiModelProperty("0正在招聘，1已经完成招聘")
    private Integer status;

    @ApiModelProperty("0未提交中期报告，1已提交中期报告")
    private Integer midTerm;


    @ApiModelProperty("0未结题，1已结题")
    private Integer conclusion;

    @ApiModelProperty("0未撤回项目，1已撤回")
    @TableField(value = "revoked")
    private Integer revoked;

    @TableField(exist = false)
    private List<Task> tasks;


    @ApiModelProperty("已招人数")
    @TableField(exist = false)
    private int num;

    @Getter @Setter
    private String remark;

    @TableField(exist = false)
    private Teacher teacher;

    @Getter@Setter @TableField(exist = false)
    private List<Student> students;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getRequirement() {
        return requirement;
    }

    public void setRequirement(String requirement) {
        this.requirement = requirement;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    public String gettName() {
        return tName;
    }

    public void settName(String tName) {
        this.tName = tName;
    }

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
            this.photo = photo;
    }

    public String getDifficulty() {
        return difficulty;
    }

    public void setDifficulty(String difficulty) {
        this.difficulty = difficulty;
    }

    public Integer getNumberOfPeople() {
        return numberOfPeople;
    }

    public void setNumberOfPeople(Integer numberOfPeople) {
        this.numberOfPeople = numberOfPeople;
    }

    public String getRemuneration() {
        return remuneration;
    }

    public void setRemuneration(String remuneration) {
        this.remuneration = remuneration;
    }

    public String getLaboratory() {
        return laboratory;
    }

    public void setLaboratory(String laboratory) {
        this.laboratory = laboratory;
    }

    public Integer getVisits() {
        return visits;
    }

    public void setVisits(Integer visits) {
        this.visits = visits;
    }

    public Date getReleaseTime() {
        return releaseTime;
    }

    public void setReleaseTime(Date releaseTime) {
//        if(releaseTime!=null&& releaseTime.getHours()<8){
//            releaseTime.setHours(releaseTime.getHours()+8);
//        }
        this.releaseTime = releaseTime;
    }

    public Date getDeadline() {
        return deadline;
    }

    public void setDeadline(Date deadline) {
//        if(deadline!=null&& deadline.getHours()<8){
//            deadline.setHours(deadline.getHours()+8);
//        }
        this.deadline = deadline;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public List<Task> getTasks() {
        return tasks;
    }

    public void setTasks(List<Task> tasks) {
        this.tasks = tasks;
    }

    public Teacher getTeacher() {
        return teacher;
    }

    public void setTeacher(Teacher teacher) {
        this.teacher = teacher;
    }

    public Integer gettId() {
        return tId;
    }

    public void settId(Integer tId) {
        this.tId = tId;
    }

    public Integer getMidTerm() {
        return midTerm;
    }

    public void setMidTerm(Integer midTerm) {
        this.midTerm = midTerm;
    }

    public Integer getConclusion() {
        return conclusion;
    }

    public void setConclusion(Integer conclusion) {
        this.conclusion = conclusion;
    }

    public Integer getRevoke() {
        return revoked;
    }

    public void setRevoke(Integer revoke) {
        this.revoked = revoke;
    }


    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    @Override
    public String toString() {
        return "Project{" +
            "id = " + id +
            ", title = " + title +
            ", description = " + description +
            ", requirement = " + requirement +
            ", major = " + major +
            ", tName = " + tName +
            ", photo = " + photo +
            ", difficulty = " + difficulty +
            ", numberOfPeople = " + numberOfPeople +
            ", remuneration = " + remuneration +
            ", laboratory = " + laboratory +
            ", visits = " + visits +
            ", releaseTime = " + releaseTime +
            ", deadline = " + deadline +
            ", status = " + status +
        "}";
    }

    @Override
    public int compareTo(Project project) {
        return project.getReleaseTime().compareTo(this.releaseTime);
    }
}
